package cn.pli.bike.ui;

import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.framemodule.utils.CommonUtils;

import cn.bingoogolapple.androidcommon.adapter.BGARecyclerViewAdapter;
import cn.bingoogolapple.androidcommon.adapter.BGAViewHolderHelper;
import cn.pli.bike.R;
import cn.pli.bike.bean.UserInfoSetBean;

/**
 * Created by shangdongzhou on 2017/11/19.
 */

public class UserInfoAdapter extends BGARecyclerViewAdapter<UserInfoSetBean> {

    public UserInfoAdapter(RecyclerView recyclerView) {
        super(recyclerView, R.layout.item_user_info);
    }

    @Override
    protected void fillData(BGAViewHolderHelper helper, int position, UserInfoSetBean model) {
        String title = CommonUtils.isEmpty(model.getTitle()) ? "" : model.getTitle();
        String describe = CommonUtils.isEmpty(model.getDescribe()) ? "" : model.getDescribe();
        TextView tvDetail = helper.getTextView(R.id.tv_item_user_info_detail);
        helper.getTextView(R.id.tv_item_user_info_title).setText(title);
        tvDetail.setText(describe);
        if (model.getColor() != 0) {
            tvDetail.setTextColor(model.getColor());
        }
        if (model.isHideNext()) {
            helper.getImageView(R.id.iv_next).setVisibility(View.INVISIBLE);
        } else {
            helper.getImageView(R.id.iv_next).setVisibility(View.VISIBLE);
        }


    }
}
